package clothes.tools.service.impl;

import clothes.tools.dao.CommodityDao;
import clothes.tools.dao.impl.CommodityDaoImpl;
import clothes.tools.pojo.Commodity;
import clothes.tools.service.CommodityService;

import java.util.List;

public class CommodityServiceImpl implements CommodityService {
    private CommodityDao commodityDao=new CommodityDaoImpl();
    @Override
    public void addCommodity(Commodity commodity) {
        commodityDao.addCommodity(commodity);
    }

    @Override
    public void deleteCommodityById(String id) {
        commodityDao.deleteCommodityById(id);
    }

    @Override
    public void updateCommodity(Commodity commodity) {
        commodityDao.updateCommodity(commodity);
    }

    @Override
    public Commodity queryCommodityById(String id) {
        return commodityDao.queryCommodityById(id);
    }

    @Override
    public List<Commodity> queryCommodity() {
        return commodityDao.queryCommodities();
    }

    @Override
    public List<Commodity> queryCommodities(String page, String limit) {
        return commodityDao.queryCommodities(page,limit);
    }

    @Override
    public boolean existsCommodityId(String id) {
        if(commodityDao.queryCommodityById(id)==null)
            return false;
        else
            return true;
    }

    @Override
    public List<Commodity> queryCommodity(String page, String limit,String name) {
        return commodityDao.queryCommodity(page, limit, name);
    }
}
